home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_01_05 / 1n05032b < prev    next >
Text File  |  1990-08-18  |  4KB  |  102 lines

  1.  
  2. ; Listing 2 written for the Phar Lap 386|ASM assembler
  3.  
  4. code         segment   dword public use32
  5.              assume    cs:code        ; set HGSC in 512x480x32 mode
  6.              align 4                  ; Copyright 1990 by Gary R. Olhoeft
  7. hstdata      equ     0C7000h          ; C000:7000    
  8. hstctrl      equ     0C7D00h          ; 34010 host addresses
  9. hstadrl      equ     0C7E00h     
  10. hstadrh      equ     0C7F00h     
  11. dpyctl       equ     0F040h           ; en.vid., noninterlac, dis extvid
  12. htotal       equ     78               ; horizontal sync timing
  13. hsblnk       equ     76               ; hsblnk-heblnk = 512/8
  14. heblnk       equ     12               ; increase to move screen right
  15. hesync       equ     9 
  16. vtotal       equ     524              ; vertical sync timing
  17. vsblnk       equ     513              ; vsblnk-veblnk = 480
  18. veblnk       equ     33               ; increase to move screen down
  19. vesync       equ     2
  20. dpytap       equ     0                ; horizontal pan
  21. dpystrt      equ     0FFFCh           ; 1 scan line per refresh
  22. bppsync      equ     0Dh              ; 32-bit/pixel, neg hor, neg ver sync
  23. cmdfreq      equ     9                ; 20 MHz, cmd & overlay
  24. daclut       equ     37h              ; 32-bit/pixel, kill overlay
  25. normfreq     equ     1                ; 20 MHz, normal color palette
  26.              public  _set512_
  27.              public  _set512          ; function name, no parameters
  28. _set512_     proc    near
  29. _set512:     push    ebp              ; save base page (frame pointer)
  30.              mov     ebp,esp          ; new frame pointer
  31.              push    es               ; save es
  32.              mov     ax,034h          ; setup Phar Lap LDT to first MByte
  33.              mov     es,ax            ; es points to first Mbyte real memory
  34.              mov     cx,0C000h        ; 34010 memory segment
  35.              mov     ax,dpyctl
  36.              and     ax,7FFFh         ; blank video
  37.              mov     bx,80h
  38.              call    write            ; write ax to cx:bx in 34010
  39.              mov     ax,htotal        ; send 34010 horizontal timing parameters
  40.              mov     bx,30h   
  41.              call    write  
  42.              mov     ax,hsblnk
  43.              mov     bx,20h   
  44.              call    write     
  45.              mov     ax,heblnk
  46.              mov     bx,10h   
  47.              call    write     
  48.              mov     ax,hesync
  49.              mov     bx,0     
  50.              call    write 
  51.              mov     ax,vtotal        ; send 34010 vertical timing parameters
  52.              mov     bx,70h   
  53.              call    write   
  54.              mov     ax,vsblnk
  55.              mov     bx,60h   
  56.              call    write   
  57.              mov     ax,veblnk
  58.              mov     bx,50h   
  59.              call    write    
  60.              mov     ax,vesync
  61.              mov     bx,40h   
  62.              call    write   
  63.              mov     ax,dpytap
  64.              mov     bx,1B0h  
  65.              call    write   
  66.              mov     ax,dpystrt
  67.              mov     bx,90h 
  68.              call    write   
  69.              mov     cx,600h      
  70.              mov     bx,0E0h          ; 0600:00E0 write config.2 reg.
  71.              mov     ax,bppsync       ; see HGSC documentation
  72.              call    write
  73.              mov     bx,0C0h          ; 0600:00C0 write config.1 reg.
  74.              mov     ax,cmdfreq
  75.              call    write
  76.              mov     bx,20h           ; 0600:0020 = cmd register in DAC
  77.              mov     ax,daclut
  78.              call    write
  79.              mov     bx,0C0h          ; 0600:00C0 = write config. 1
  80.              mov     ax,normfreq
  81.              call    write
  82.              mov     ax,0C000h        ; no autoincrement
  83.              mov     es:hstctrl,ax    ; setup 34010
  84.              mov     cx,0C000h
  85.              mov     ax,dpyctl
  86.              mov     bx,80h
  87.              call    write            ; enable video
  88.              pop     es               ; restore es
  89.              pop     ebp              ; restore base page
  90. _set512_     endp
  91.  
  92. write        proc    near
  93.              mov     es:hstadrl,bx  
  94.              mov     es:hstadrh,cx  
  95.              mov     es:hstdata,ax    ; write ax to cx:bx in 34010 memory
  96.              ret
  97. write        endp
  98.  
  99. code         ends
  100.              end 
  101.  
  102.